# 残缺的数字(好题, 强化位运算)

def count_num():
    # 输入的18个显示状态码
    input_arr = [0b0000011, 0b1001011, 0b0000001, 0b0100001, 0b0101011, 0b0110110, 0b1111111, 0b0010110, 0b0101001,
                 0b0010110, 0b1011100, 0b0100110, 0b1010000, 0b0010011, 0b0001111, 0b0101101, 0b0110101, 0b1101010]
    # 对应0-9的状态码
    bin_arr = [0b1111110, 0b0110000, 0b1101101, 0b1111001, 0b0110011, 0b1011011, 0b1011111, 0b1110000, 0b1111111,
               0b1111011]
    counts = []
    # 遍历每一个输入的显示状态码
    for i in range(len(input_arr)):
        match_cnt = 0
        # 遍历每一个正确的状态码
        for j in range(len(bin_arr)):
            is_match = input_arr[i] & bin_arr[j]  # 两个状态码进行&"与运算", 码相同时为1, 不同时为0,
            if is_match == input_arr[i]:  # 如果匹配码和输入码相同, 则表示该输入码可以兼容对应的正确的状态码
                match_cnt += 1
        counts.append(match_cnt)
    res = 1
    for cnt in counts:
        if cnt != 0:
            res *= cnt
    return res


if __name__ == '__main__':
    # 测试
    # a = 0b1111110
    # b = 0b1111111
    # print(bin(a & b))
    # print(bin(a | b))
    # print(bin(a ^ b))
    # a = 0b1110011
    # b = 0b1111111
    # print(bin(a & b))
    # print(bin(a | b))
    # print(bin(a ^ b))
    print(count_num())
